package com.bawei.lizhiyu1228.ui.act;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bawei.lic_core.db.DaoSession;
import com.bawei.lizhiyu1228.R;
import com.bawei.lizhiyu1228.greendao.DaoAdapter;
import com.bawei.lizhiyu1228.greendao.DaoManager;
import com.bawei.lizhiyu1228.greendao.Foots;

import java.util.List;

public class DaoActivity extends AppCompatActivity {

    private RecyclerView daoRv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dao);
        initView();


        DaoSession daoSession = DaoManager.getInstance().getDaoSession();
        List<Foots> foots = daoSession.loadAll(Foots.class);
        DaoAdapter daoAdapter = new DaoAdapter(foots);

        daoRv.setAdapter(daoAdapter);


    }

    private void initView() {
        daoRv = (RecyclerView) findViewById(R.id.dao_rv);
        daoRv.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
    }
}